package com.example.supermarket.controller;


import com.example.supermarket.entity.ResponseResult;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EmailController {
    @Autowired
    RabbitTemplate rabbitTemplate;

    @RequestMapping("/email/{email}")
    public ResponseResult email(@PathVariable("email")String email){

        rabbitTemplate.convertSendAndReceive("exchangetopic","email",email);
        return new ResponseResult<>(200,"success","ok");
    }
}
